package net.oschina.jhssm.module.system.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import net.oschina.jhssm.common.entity.R;
import net.oschina.jhssm.module.system.entity.SysLog;
import net.oschina.jhssm.module.system.query.SysLogQuery;
import net.oschina.jhssm.module.system.service.ISysLogService;

@Controller
@RequestMapping(value = "setting/logs")
public class SyslogController {

	@Autowired
	private ISysLogService sysLogService;
	
	@RequestMapping(value = "list", method = RequestMethod.GET)
	@ResponseBody
	public R list(SysLogQuery query) {
		List<SysLog> list = sysLogService.selectForList(query);
		return R.ok("list", list);
	}
        
	
	@RequestMapping(value = "clear", method = RequestMethod.POST)
	@ResponseBody
    public R clear(SysLogQuery query) {
        Integer row = sysLogService.clear(query);
        return R.ok("row", row);
    }
	
}
